package common

import (
	"bufio"
	"os"
	"strings"
)

func LoadConfig(path string) {
	f, err := os.Open(path)

	if err != nil {
		panic(err)
	}

	fileScanner := bufio.NewScanner(f)
	fileScanner.Split(bufio.ScanLines)

	for fileScanner.Scan() {
		env := strings.SplitN(fileScanner.Text(), "=", 2)
		if env[0] == "" {
			continue
		}
		os.Setenv(env[0], env[1])
	}

	f.Close()
}
